import '../viewmodel/regular_menu_contain_view_model.dart';

class OrderRequestData {
  dynamic siteId;
  String? siteName;
  String? date;
  String? elderName;
  dynamic elderHumanId;
  dynamic useType;
  String? useTypeName;
  dynamic timeSection;
  dynamic userRoomId;
  num totalPrice = 0;
  List<SelectFoodData> selectFood;
  List<int> hasOrderedMeal = [];
  List<String> weekList = [];
  List<DaySelectFood> weekSelectFood = [];
  Map<String, List<int>>? weekHasOrderedMeal = {};
  Map<num, num?>? limitMap = {};

  var weekDay = 1;
  dynamic menuId;
  dynamic menuTypeId;

  bool get hasLimit {
    var has = false;
    (limitMap??{}).forEach((key, value) {
      if(value!=null){
        has = true;
      }
    });
    return has;
  }

  OrderRequestData(
      {this.siteId,
      this.siteName,
      this.date,
      this.elderHumanId,
      this.useType,
      this.useTypeName,
      this.timeSection,
      this.elderName,
      this.totalPrice = 0,
      this.selectFood = const [],
      this.weekList = const [],
      this.hasOrderedMeal = const [],
      this.menuId,
      this.menuTypeId,
      this.weekHasOrderedMeal,
      this.limitMap ,
      this.userRoomId ,
      this.weekSelectFood = const []});

  OrderRequestData copyWith({
    dynamic? siteId,
    String? siteName,
    String? date,
    String? elderName,
    dynamic? elderHumanId,
    dynamic? useType,
    dynamic? timeSection,
    num? totalPrice,
    List<SelectFoodData>? selectFood,
    List<int>? hasOrderedMeal,
    List<DaySelectFood>? weekSelectFood,
    String? useTypeName,
    dynamic? menuId,
    dynamic? menuTypeId,
    dynamic? userRoomId,
    Map<num, num?>? limitMap
  }) {
    return OrderRequestData(
        siteId: siteId ?? this.siteId,
        siteName: siteName ?? this.siteName,
        date: date ?? this.date,
        elderName: elderName ?? this.elderName,
        elderHumanId: elderHumanId ?? this.elderHumanId,
        useType: useType ?? this.useType,
        timeSection: timeSection ?? this.timeSection,
        totalPrice: totalPrice ?? this.totalPrice,
        selectFood:
            selectFood ?? this.selectFood.map((e) => e.copyWith()).toList(),
        hasOrderedMeal: hasOrderedMeal ?? this.hasOrderedMeal,
        menuId: menuId ?? this.menuId,
      menuTypeId: menuTypeId ?? this.menuTypeId,
        useTypeName: useTypeName ?? this.useTypeName,
        weekSelectFood: weekSelectFood ?? this.weekSelectFood,
      userRoomId: userRoomId ?? this.userRoomId,
      limitMap: limitMap ?? this.limitMap,
    );
  }
}
